<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/includeTop.jsp" %>
<%@ include file="/WEB-INF/jsp/includeTaglib.jsp" %>

<table width="100%" border="0" cellpadding="0" cellspacing="5">
  <tr>
    <td valign="top">
      <table class="dbborder" width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="bottom" class="blueTableBg">&nbsp;语音模板管理&nbsp;-&nbsp;编辑模板</td>
        </tr>
        <tr>
          <td>
            <table width="100%" border="0" cellpadding="0" cellspacing="5">
              <tr>
                <td>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td class="dashTopLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTop" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashTopRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td align="center">
                        <table width="100%" border="0" cellpadding="0" cellspacing="3">
                          <form id="editVoiceTemplateForm" method="post">
		                      <input type="hidden" name="updatekey" value="${voiceTemplate.id}">
                          <tr>
                             	 <td width="20%" height="20" class="globalText">语音模板描述</td>
                           		 <td width="80%" class="globalText">
                            	<input id="voiceDescription" type="text" class="txtbox" size="20" name="voiceDescription" value="${voiceTemplate.voiceDescription}"/>
                           		 </td>
                          </tr>
                          <tr id="quickViewFunctionTR">
                            <td width="150" height="20" class="globalText" colspan="2">语音内容：&nbsp;
                            <a id="quickViewFunction" href="quickViewFunction.html?type=1" rel="quickViewFunction.html?type=1" title="插入函数">插入函数</a>
                            </td>
                          </tr>
                          <tr>
                            <td width="114" height="20" class="globalText" colspan="2">
                            	<textarea id="voiceContent" name="voiceContent" rows="5" cols="100">${voiceTemplate.voiceContent}</textarea>                            	
                            </td>
                          </tr>
                          <tr>
                            <td align="center" colspan="2">
                              <table border="0" cellpadding="0" cellspacing="2">
                                <tr>
                                  <td><input type="button" class="btnStyle" value="  保存  " onclick="javascript:doSubmit()"></td>
                                  <td><input type="button" class="btnStyle" value="  取消  " onclick="javascript:doCancel()"></td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                          </form>
                        </table>
                      </td>
                      <td class="dashRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                    <tr>
                      <td class="dashBottomLeft"><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottom" width=100%><img src="images/spacer.gif" width="7" height="7"></td>
                      <td class="dashBottomRight"><img src="images/spacer.gif" width="7" height="7"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<script language="javascript">
	
	function doSubmit(){
		  var voiceDescription = document.getElementById("voiceDescription").value.trim();
			if (validateEmpty(voiceDescription)) {
				alert("语音模板描述 不能为空");
				return false;
			}

	   var voiceContent = document.getElementById("voiceContent").value.trim();
		 if (validateEmpty(voiceContent)) {
				alert("语音内容 不能为空");
				return false;
		 }
		 
		document.getElementById("editVoiceTemplateForm").action = "<c:url value='editVoiceTemplate.html' />";
		document.getElementById("editVoiceTemplateForm").submit();
	}
	
	function doCancel(){
		document.getElementById("editVoiceTemplateForm").action = "<c:url value='voiceTemplateMain.html' />";	
		document.getElementById("editVoiceTemplateForm").submit();
	}
	
	$(document).ready(function() {
		//查看可供选择的函数
		$("#quickViewFunctionTR a[id*=quickViewFunction]").cluetip({
			width:'500', activation: 'click', sticky: true, closePosition: 'title', closeText:'关闭', arrows: true, mouseOutClose: false, positionBy:'mouse',leftOffset:5,ajaxProcess: function(data) {return data;}
    });

    $("#voiceContent").setCaret();
	});

</script>